<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" import="java.sql.*"%>
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page import="ookweb.*"%>
<%request.setCharacterEncoding("UTF-8");  %>
<%@ include file="/head.jsp" %> 
<%
String dbuser = application.getInitParameter("dbuser");
String dbpass = application.getInitParameter("dbpass");
String dburl  = application.getInitParameter("dburl");

Conn con =new Conn(dbuser,dbpass,dburl);

String menu="4"; 
String  tmp="";

String act=request.getParameter("reg");
String nuname=(String)session.getAttribute("ookweb_user_username");

if("".equals(nuname) || nuname==null){
 response.sendRedirect(basePath+"ookweb/login.jsp");
}

String username="",title="",content="",userid="";
userid=(String)session.getAttribute("ookweb_user_userid");
username=nuname;
 String sql="";
if("start".equals(act)){

  Data data=new Data(dbuser,dbpass,dburl);
	title=request.getParameter("title");
	content=request.getParameter("content");
	if(!("".equals(title) || title==null || "".equals(content) || content==null)){
	java.text.SimpleDateFormat formatter=new java.text.SimpleDateFormat("yyyy-MM-dd");
         java.util.Date currentTime=new java.util.Date();
         String time=formatter.format(currentTime);
	 sql="insert into  web_usermsg(msgid,title,content,userid,addtime)values(WEB_USERMSG_SEQ.nextval,'"+title+"','"+content+"',"+userid+",to_date('"+time+"','yyyy/mm/dd'))";
	 int num=data.insert(sql);
	  response.sendRedirect(path+"/ookweb/msg.jsp");
	} 
} 
%>
     <%@ include file="/menu.jsp" %> 
     <div class="div8"></div>
     <table width="100%" border="0" cellpadding="0" cellspacing="0">
       <tr>
         <td align="center" valign="top">
           <table width="100%" height="627" border="0" cellpadding="0" cellspacing="0">
             <tr >
               <td align="left" valign="top" >
               <table width="100%" border="0">
                  <tr>
                    <td style=" background:url(images/msg.gif) no-repeat" height="38"><table width="100%" border="0">
                      <tr>
                        <td width="10%" align="center" style=" color:#333333; font-size:14px; font-weight:bold;">留言板</td>
                        <td width="57%">&nbsp;</td>
                        <td width="33%" align="right" class="hui12">首页-&gt;留言板</td>
                      </tr>
                    </table></td>
                  </tr>
                </table>
                <div style=" font-size:12px; color:#999999; border-bottom:1px dashed #CCCCCC">&nbsp;&nbsp;&nbsp;&nbsp;欢迎登录东方通网站</div><br>
                <table width="100%" border="0" cellpadding="8" align="right">
	      <tr>
             <td width="22%" height="181" align="center" valign="top" >
               <table width="120" border="0" cellpadding="0" cellspacing="0">
                 <tr>
                   <td style=" height:26px; color:#666666;  font-size:14px; line-height:26px; vertical-align:middle; border-bottom:1px solid #9C9C9C"><a href="userinfo.jsp" style="color:#cccccc;text-decoration:none; font-size:14px;">我的个人资料</a></td>
                 </tr>
                 <tr>
                   <td  style=" height:26px; color:#666666;font-size:14px; line-height:26px;vertical-align:middle;border-bottom:1px solid #9C9C9C"><a href="msg.jsp" style="color:#cccccc; text-decoration:none;font-size:14px;">我的疑问解答</a></td>
                 </tr>
                 <tr>
                   <td  style=" height:26px; color:#666666;font-size:14px; line-height:26px;font-weight:bold;vertical-align:middle;border-bottom:1px solid #9C9C9C"><a href="sub.jsp" style="color:#cccccc;text-decoration:none;font-size:14px;">我要提问</a></td>
                 </tr>
               </table></td>
             <td width="78%" valign="top" class="infolist"><table width="542" border="0" cellpadding="0" cellspacing="0">
               <tr>
                 <td><img src="images/ucarea.gif" width="545" height="22" /></td>
               </tr>
               <tr align="center">
                 <td height="288" valign="top" background="images/ucbj.gif"><table width="96%" border="0" cellpadding="0" cellspacing="0">
                   <tr style=" border-bottom:1px solid #999999;">
                     <td width="16%" height="37" align="right" style=" border-bottom:1px solid #999999;">&nbsp; </td>
                     <td width="84%" align="left" style=" border-bottom:1px solid #999999;"><span class="STYLE3">我要提问</span></td>
                   </tr>
                   <tr align="left">
                     <td height="43" colspan="2"> 这是你当前的个人信息，根据需要更新你的个人资料。</td>
                   </tr>
                   <tr>
                     <td colspan="2">&nbsp;</td>
                   </tr>
                   <tr>
                     <td colspan="2">
                      <form name="form1" method="post" action="<%=basePath%>ookweb/sub.jsp" onSubmit="return CheckForm();">
                      <input name="reg" type="hidden" value="start" />
                     <table width="90%" border="0" align="center" cellpadding="4" cellspacing="0">
                       <tbody>
                         <tr height="28">
                           <td width="34%" height="35" align="right" bgcolor="#FFFFFF" ><strong>标题:</strong><br />
                           </td>
                           <td height="35" bgcolor="#FFFFFF"  align="left"><input name="title"  type="text" class="input" id="title" value=""/>
                               <span id="nameinfo"></span></td>
                         </tr>
                         <tr height="28">
                           <td width="34%" height="35" align="right" bgcolor="#FFFFFF" ><strong>内容：</strong><br />
                           </td>
                           <td height="35" bgcolor="#FFFFFF"  align="left"><textarea name="content" id="content" rows="8" cols="50"></textarea>
                               <span id="nameinfo"></span></td>
                         </tr>
                         <tr>
                           <td height="35" colspan="2" bgcolor="#FFFFFF"><div align="center">
                               <input name="postreg" type="submit" class="cmd" value="提交" />
                             &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                             <input name="resetreg" type="reset" class="cmd" value="重置" />
                           </div></td>
                         </tr>
                       </tbody>
                     </table>
                     </form>
                     </td>
                   </tr>
                 </table></td>
               </tr>
               <tr>
                 <td><img src="images/ucareabot.gif" width="545" height="22" /></td>
               </tr>
             </table>
               <script language="javascript" type="text/javascript">
function CheckForm(){
	var iu, iuu, regArray=new Array("","???","???","???","???","???","???","???"+
	"!","@","#","$","%","^","&","*","(",")","-","+","=","|","'","[","]","???","~","`"+
	"!","<",">","???","???","???","???","???","??","??"); 
	iuu=regArray.length;
	
	
	for(iu=1;iu<=iuu;iu++){
		if (document.forms[0].title.value.indexOf(regArray[iu])!=-1){
			alert("标题不能够包含字符：" + regArray[iu]);
			document.forms[0].true_name.focus();
			return false;
		}
	}
	if (document.forms[0].title.value.length==0) {
		alert("标题姓名不能够为空.");
		document.forms[0].true_name.focus();
		return false;
	}
	if (document.forms[0].content.value.length==0) {
		alert("内容不能够为空.");
		document.forms[0].true_name.focus();
		return false;
	}	
	return true;
} 
</script>
               </td>
	      </tr>
     </table>

               </td>
               </tr>
           </table></td>
         </tr>
     </table>    
        <%@ include file="/right.jsp" %>
</div>
 <%@ include file="foot.html" %>